package com.cungmua.app.model.request;

import com.cungmua.app.utils.AppUtils;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Created by kelvin.nguyen on 6/26/14.
 */
public class LikeRequest extends AuthenticatedRequest {
    private int userId;
    private int dealId;
    private int cityId;
    private boolean liked;

    public LikeRequest(String deviceId, String token) {
        super(deviceId, token);
    }

    @JsonProperty("UserId")
    public void setUserId(int userId) {
        this.userId = userId;
    }

    @JsonProperty("PId")
    public void setDealId(int dealId) {
        this.dealId = dealId;
    }

    @JsonProperty("CityId")
    public void setCityId(int cityId) {
        this.cityId = cityId;
    }

    public void setLiked(boolean liked) {
        this.liked = liked;
    }

    public int getUserId() {
        return userId;
    }

    public int getDealId() {
        return dealId;
    }

    public int getCityId() {
        return cityId;
    }

    @JsonProperty("IsLiked")
    public int isLiked() {
        return liked ? 1 : 0;
    }

    @Override
    public String getSign() {
        return AppUtils.MD5(String.valueOf(getUserId()) + getDealId() + getCityId() +
                isLiked() + getVersion() + getDeviceId() + getToken());
    }
}

